package com.jyk.blog.service.impl;

import com.jyk.blog.mapper.UserMapper;
import com.jyk.blog.po.User;
import com.jyk.blog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> queryAll() {
        return userMapper.findAll();
    }

    @Override
    public User queryByEmail(String email) {
        return userMapper.findByEmail(email);
    }

    @Override
    public User queryByName(String name) {
        return userMapper.findByName(name);
    }

    @Override
    public User queryById(int id) {
        return userMapper.findById(id);
    }

    @Override
    public void insert(User user) {
        userMapper.insert(user);
    }

    @Override
    public void delete(User user) {
        userMapper.delete(user);
    }

    @Override
    public String getPermission(User user) {
        return userMapper.getPermission(user);
    }
}
